#!/bin/bash

GNB_DIR=$(dirname $(cd "$(dirname "$0")";pwd))
gnb_nodeid=$1


show_usage(){
   echo "usage: $0 node_id"
}

if [ -z "$gnb_nodeid" ]; then
	show_usage
	exit;
fi


set_node_id(){
  sed -i "1s/^.*$/nodeid $gnb_nodeid/" $GNB_DIR/conf/node.conf
  echo "set $GNB_DIR/conf/node.conf nodeid $gnb_nodeid"
}

copy_cert(){
  cp $GNB_DIR/certs/public/$gnb_nodeid.public $GNB_DIR/conf/security
  echo "cp $GNB_DIR/certs/public/$gnb_nodeid.public $GNB_DIR/conf/security"
  cp $GNB_DIR/certs/private/$gnb_nodeid.private $GNB_DIR/conf/security
  echo "cp $GNB_DIR/certs/private/$gnb_nodeid.private $GNB_DIR/conf/security"
}



set_node_id
copy_cert








